"""
用户 数据库模型
"""

from pydantic import (
    BaseModel,
    Field,
)

import utils.enum_utils as enum


class UserDBModel(BaseModel):
    """ 用户 数据库模型 """

    username: str = Field(
        ...,
        title="用户名",
        min_length=3,
        max_length=20,
    )

    password: str = Field(
        ...,
        title="密码（加密后的）",
        description="固定长度的 64 位字符",
        min_length=64,
        max_length=64,
    )

    nickname: str = Field(
        ...,
        title="昵称",
        min_length=3,
        max_length=20,
    )

    code: str = Field(
        ...,
        title="编号",
        description="SwaggerTag.name + StringGenerator.generate_unique_code 生成的数据",
        min_length=20,
        max_length=20,
    )

    gender: enum.Gender = Field(
        ...,
        title="性别",
        description="0.未知 / 1.男 / 2.女 / 3.保密",
    )

    last_active: str = Field(
        ...,
        title="最近活跃时间",
        description="用户发生增删改查操作，需要手动修改 格式：YYYY-MM-DD HH:mm:ss",
    )
